package com.mtao.controller.admin;

import com.mtao.ArticleCategoryService;
import com.mtao.bean.RestBean;
import com.mtao.utils.DateUtils;
import com.mtao.entity.ArticleCategory;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/category")
public class ArticleCategoryController {

    @Resource
    private ArticleCategoryService articleCategoryService;


    /**
     * 查手文章类型list
     * @return
     */
    @PostMapping("/add")
    public RestBean add(@RequestBody ArticleCategory articleCategory){
        System.out.println("===================");
        System.out.println("Date"+ DateUtils.getDate());
        articleCategoryService.add(articleCategory);
        return RestBean.success("添加成功");
    }

    /**
     * 查手文章类型list
     * @return
     */
    @PostMapping("/update")
    public RestBean update(@RequestBody ArticleCategory articleCategory){
        System.out.println("===================");
        System.out.println("Date"+ DateUtils.getDate());
        articleCategoryService.update(articleCategory);
        return RestBean.success("更新成功");
    }
}
